package jobscheduling.algorithms.pso;


import java.util.Arrays;

public class Solution{

        private int eval_;
       
        private int[] solution_;
       
        private Solution(){
                eval_ = 0;
                solution_ = null;
        }
       
        public Solution(InputData data, int[] solution){
                solution_ = new int[data.getJobs()];
                for(int i=0; i<data.getJobs(); i++){
                        solution_[i] = solution[i];
                }
                eval_ = SolutionEvaluator.getEval(data, solution);
        }
       

       
        public int getEval(){
                return eval_;
        }
       
        public int[] getSolution(){
                return solution_;
        }
       
        public Solution getSolutionCopy(){
                Solution tmpSolution = new Solution();
                tmpSolution.solution_ = new int[this.solution_.length];
                tmpSolution.eval_ = this.eval_;
                for(int i=0; i<this.solution_.length; i++){
                        tmpSolution.solution_[i] = this.solution_[i];
                }
                return tmpSolution;
        }
       
        public String toString(){
                return this.getClass()+"("+eval_+", "+Arrays.toString(solution_)+")";
        }
}

